home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
FROMUTS
/
UNIXLIB37B
/
src
/
c
/
strdup
< prev
next >
Wrap
Text File
|
1992-02-17
|
603b
|
38 lines
#ifdef __STDC__
static char sccs_id[] = "@(#) strdup.c 1.0 "__DATE__" HJR";
#else
static char sccs_id[] = "@(#) strdup.c 1.0 8/11/91 HJR";
#endif
/* strdup.c (c) Copyright 1990 H.Rogers */
#ifndef __STDC__
#include "sys/types.h"
#endif
#include <string.h>
#ifdef ARCH
#include "sys/unix.h"
#else
#include <stdlib.h>
#endif
#ifdef __STDC__
char *strdup(register const char *s1)
#else
char *strdup(s)
register const char *s1;
#endif
{
#ifdef ARCH
return(__permstr(s1));
#else
register int i = strlen(s1) + 1;
register char *s2;
if (!(s2 = malloc(i))) return(0);
memcpy(s2,s1,i);
return(s2);
#endif
}